<?php

namespace app\factory\register;

use app\factory\model\RequestAgreement;
use app\factory\model\ResponseAgreement;
use app\factory\tool\frameVerify\EncryptionTool;

/**
 * ClassName:框架注册类
 * @author leijunxiang
 * @time 2024/8/31
 * @auditor
 */
class FrameRegister
{

    /**
     * 注册工具()
     * @return void
     */
    public function regTool($objKey,$type)
    {
        $obj = null;
        if (empty($objKey)&& empty($type)) {
            return null;
        }
        switch ($type) {
            //加密工具类
            case EncryptionTool::TOOL_ENCRYPTION_TOOL:
            $obj = new EncryptionTool();
                bind($objKey, $obj);
                break;
        }
        return $obj;
    }

    /**
     * 注册M层
     * @return void
     */
    public function regModel($objKey,$type)
    {
        $obj = null;
        if (empty($objKey)&& empty($type)) {
            return null;
        }
        switch ($type) {
            //框架返回协议对象
            case ResponseAgreement::MODEL_RESPONSE_AGREEMENT:
                $obj = new ResponseAgreement();
                bind($objKey, $obj);
                break;
            //框架返回协议对象
            case RequestAgreement::MODEL_REQUEST_AGREEMENT:
                $obj = new RequestAgreement();
                bind($objKey, $obj);
                break;
        }
        return $obj;
    }

    /**
     * 注册常驻M层
     * @return void
     */
    public function regResidentModel($objKey,$type)
    {
        $obj = null;
        if (empty($objKey)&& empty($type)) {
            return null;
        }
        switch ($type) {
            //框架返回协议对象
//            case ResponseAgreement::MODEL_RESPONSE_AGREEMENT:
//                $obj = new ResponseAgreement();
//                bind($objKey, $obj);
//                break;
        }
        return $obj;
    }
}